package com.financing.platform.service.impl;

import java.sql.SQLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.financing.platform.dao.IInfoSubscribeDao;
import com.financing.platform.dto.InfoSubscribeDTO;
import com.financing.platform.service.IInfoSubscribeService;
import com.financing.platform.vo.InfoSubscribeVO;

@Service("infoSubscribeServiceImpl")
@Transactional
public class InfoSubscribeServiceImpl extends BaseServiceImpl implements
	IInfoSubscribeService {

	@Autowired
	private IInfoSubscribeDao infoSubscribeDaoImpl;

	@SuppressWarnings("unchecked")
	@Override
	public List<InfoSubscribeVO> queryInfoSubscribeList(
			InfoSubscribeDTO infoSubscribeDTO) throws SQLException {
		Map<String,Object> map =  new HashMap<String,Object>();
		if("01".equals(infoSubscribeDTO.getSubType())){
			map.put("begin", infoSubscribeDTO.getBegin());
			map.put("pageSize", infoSubscribeDTO.getPageSize());
			map.put("subId", infoSubscribeDTO.getSubId());
			map.put("subType", infoSubscribeDTO.getSubType());
			map.put("subMail", infoSubscribeDTO.getSubMail());
			map.put("createBy", infoSubscribeDTO.getCreateBy());
			map.put("subField", "C_NAME");
			map.put("subTable", "fp_project_company");
			map.put("subTableId", "id");
			
		}else{
			log.info("queryInfoSubscribeList subType is not exist :"+infoSubscribeDTO.getSubType());
			return Collections.EMPTY_LIST;
		}
		return infoSubscribeDaoImpl.queryInfoSubscribeList(map);
	}

	@Override
	public int queryInfoSubscribedListCount(InfoSubscribeDTO infoSubscribeDTO)
			throws SQLException {
		return infoSubscribeDaoImpl.queryInfoSubscribedListCount(infoSubscribeDTO);
	}

	
	
}
